package it.tplmatera;


import java.util.Arrays;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class MainActivity extends ListActivity {
	
	ArrayAdapter<String> arrayAdapterLinee;
	ListView lv;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		lv = getListView();
		
		arrayAdapterLinee = new ArrayAdapter<String>(this, R.layout.item, Arrays.asList(getResources().getStringArray(R.array.linee)));
		lv.setAdapter(arrayAdapterLinee);
		
	}
	
	public void showLinea(View v) {
		ListView lv = getListView();
		System.out.println(lv.getPositionForView(v));
		Intent intent = new Intent(this, ShowLineaActivity.class);
		intent.putExtra("keyLinea", lv.getPositionForView(v));
		startActivity(intent);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}
